<template>
  <van-nav-bar
  :title="title"
  :left-text="leftText"
  @click-left="onClickLeft"
  left-arrow>
    <template #right>
      <slot name="right">
        <van-icon name="search" size="18" @click="$router.push('/search')"/>
      </slot>
    </template>
  </van-nav-bar>
</template>

<script>
export default {
  props: {
    title: {
      type: String,
      default: '标题'
    },
    leftText: {
      type: String,
      default: ''
    },
    leftCklick: {
      type: Function,
      default: null,
    }
  },
  methods: {
    onClickLeft() {
      if(this.leftCklick) return this.leftCklick()
      this.$router.back()
    },
  }
}
</script>